package ai.peanut.one.api.tread.test2;

public class ThreadTestIsAll extends  Thread{

    private A a ;
   public ThreadTestIsAll(A a){
       this.a = a ;
   }

    @Override
    public  void run() {
//        a.aa();

        a.testJoin();
    }
}

class A{
    public synchronized void  aa(){
        System.out.println("======================================");
        try {
            wait();
            System.out.println("2222222222222222222222222222222");
        } catch (InterruptedException e) {
            System.out.println("11111111111111111111111111111111");
        }
    }

    public  void  sleep(){
        System.out.println("======================================");
        try {
            Thread.sleep(5000);
            System.out.println("2222222222222222222222222222222");
        } catch (InterruptedException e) {
            System.out.println("11111111111111111111111111111111");
        }
    }

    public  void  testJoin(){
        while(true) {
            System.out.println("======================================");
//        try {
//            Thread.sleep(5000);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
        }
    }
}
